// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router';
import Layout from '@/views/layout/index.vue'; // 布局组件
import Login from '@/views/login/index.vue'; // 登录页面
import Index from '@/views/index/index.vue';
import Clazz from '@/views/clazz/index.vue';
import Stu from '@/views/stu/index.vue';
import Dept from '@/views/dept/index.vue';
import Emp from '@/views/emp/index.vue';
import EmpReport from '@/views/report/emp/index.vue';
import StuReport from '@/views/report/stu/index.vue';
import Log from '@/views/log/index.vue';

const routes = [
  { path: '/login', name: 'Login', component: Login, },
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect: '/index', // 默认跳转首页
    children: [
      { path: 'index', name: 'Index', component: Index, },
      { path: '/clazz', name: 'Clazz', component: Clazz, },
      { path: '/stu', name: 'Stu', component: Stu, },
      { path: 'dept', name: 'Dept', component: Dept, },
      { path: 'emp', name: 'Emp', component: Emp, },
      { path: 'empReport', name: 'EmpReport', component: EmpReport, },
      { path: 'stuReport', name: 'StuReport', component: StuReport, },
      { path: 'log', name: 'Log', component: Log, },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;